home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_perl.idb / usr / freeware / catman / p_man / cat3 / Time::Local.Z / Time::Local
Encoding:
Text File  |  1998-10-28  |  2.1 KB  |  67 lines

  1.  
  2.  
  3.  
  4.      TTTTiiiimmmmeeee::::::::LLLLooooccccaaaallll((((3333))))  22223333////JJJJuuuullll////99998888 ((((ppppeeeerrrrllll 5555....000000005555,,,, ppppaaaattttcccchhhh 00002222))))    TTTTiiiimmmmeeee::::::::LLLLooooccccaaaallll((((3333))))
  5.  
  6.  
  7.  
  8.      NNNNAAAAMMMMEEEE
  9.       Time::Local -    efficiently compute time from local and    GMT
  10.       time
  11.  
  12.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  13.           $time = timelocal($sec,$min,$hours,$mday,$mon,$year);
  14.           $time = timegm($sec,$min,$hours,$mday,$mon,$year);
  15.  
  16.  
  17.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  18.       These    routines are quite efficient and yet are always
  19.       guaranteed to    agree with _l_o_c_a_l_t_i_m_e() and _g_m_t_i_m_e().  We
  20.       manage this by caching the start times of any    months we've
  21.       seen before.    If we know the start time of the month,    we can
  22.       always calculate any time within the month.  The start times
  23.       themselves are guessed by successive approximation starting
  24.       at the current time, since most dates    seen in    practice are
  25.       close    to the current date.  Unlike algorithms    that do    a
  26.       binary search    (calling gmtime    once for each bit of the time
  27.       value, resulting in 32 calls), this algorithm    calls it at
  28.       most 6 times,    and usually only once or twice.     If you    hit
  29.       the month cache, of course, it doesn't call it at all.
  30.  
  31.       timelocal is implemented using the same cache.  We just
  32.       assume that we're translating    a GMT time, and    then fudge it
  33.       when we're done for the timezone and daylight    savings
  34.       arguments.  The timezone is determined by examining the
  35.       result of _l_o_c_a_l_t_i_m_e(0) when the package is initialized.  The
  36.       daylight savings offset is currently assumed to be one hour.
  37.  
  38.       Both routines    return -1 if the integer limit is hit. I.e.
  39.       for dates after the 1st of January, 2038 on most machines.
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.      Page 1                        (printed 10/23/98)
  64.  
  65.  
  66.  
  67.